#include <stdio.h>                                                                                                                                                                                           
#include <stdlib.h>
#include <string.h>
       
#include "color.h"
#include "struct.h"
	    
int parameter(num_t *num)
{
	int count = 0;
	int length = 0;
	char *input_a_num;
	char input_b_num;
		    
	while (1) {
		scanf("%s",&input_b_num);
		       
		length = strlen(&input_b_num);
		input_a_num = (char*)malloc(sizeof(length));
		strcpy(input_a_num,&input_b_num);
		count = 0;

		if (length == 1) {
			if (input_a_num[0] == 'q') {
				exit(0);
			}
		}	
			   
		for (count = 0; count < length; count++) {
			if (input_a_num[count] >= '0' && input_a_num[count] <= '9')
			      continue;
			else {
				printf(PURPLE_COLOR"你以为键盘是随便敲的吗\n"
			               "请重新输入"RESET_COLOR"\n");
				break;
			}
		}
		if (count == length) {
			num->input = atoi(input_a_num);
				      
			if (num->input> 1000 ||num->input <= 0) {
				printf(PURPLE_COLOR"小垃圾。看清规则，李总裁快被拐跑啦!"RESET_COLOR"\n");
			}
			else
				break;
		}
	}
	return 0;
}				        

